{extend name="public:base"/}

{block name="title"}查看店铺申请{/block}
{block name="style"}{/block}

{block name="main"}

<section class="content">

    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header m-b-sm">
                    <h3 class="box-title">查看店铺申请<?=$model['apply_id']?></h3>
                </div>
                <!--
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="/backend/addons/rf-merchants/config/index"> 配置管理</a></li>
                        <li><a href="/backend/addons/rf-merchants/config-cate/index"> 配置分类</a></li>
                        <li class="pull-right">
                            <a class="btn btn-primary btn-xs" href="/backend/addons/rf-wechat/rule/edit"><i
                                    class="fa fa-plus"></i> 创建</a>
                        </li>
                    </ul>
                </div>
                -->

                <div class="clearfix"></div>

                <div class="box-body table-responsive">
                    <?php if($model['apply_type'] == 1){?>
                    <table id="table-index" class="table table-hover" style="display:block;">
                        <thead>
                    <tr>
                        <th style="width: 20%;">字段名称</th>
                        <th style="width: 20%;">字段数据</th>
                    </tr>

                    </thead>
                        <tbody>


                        <tr>
                            <td>公司名称</td>

                            <td>
                                <span class="m-l-sm"><?=$model['company_name']?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>联系地址</td>

                            <td>
                                <span class="m-l-sm"><?=getProvinceCityName($model['province_id'])?>-<?=getProvinceCityName($model['city_id'])?>-<?=getProvinceCityName($model['district_id'])?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>详细地址</td>

                            <td>
                                <span class="m-l-sm"><?=$model['address_detail']?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>联系人姓名</td>

                            <td>
                                <span class="m-l-sm"><?=$model['contacts_name']?></span>
                            </td>
                        </tr>
                                                <tr>
                            <td>联系人电话</td>

                            <td>
                                <span class="m-l-sm"><?=$model['contacts_phone']?></span>
                            </td>
                        </tr>
                                                <tr>
                            <td>联系人邮箱</td>

                            <td>
                                <span class="m-l-sm"><?=$model['contacts_email']?></span>
                            </td>
                        </tr>
                                                <tr>
                            <td>申请人身份证号</td>

                            <td>
                                <span class="m-l-sm"><?=$model['contacts_card_no']?></span>
                            </td>
                        </tr>
                                                <tr>
                            <td>申请人手持身份证电子版</td>

                            <td>
                                <span class="m-l-sm"><?=showImage($model['contacts_card_electronic_1'],300,300)?></span>
                            </td>
                        </tr>
                                                <tr>
                            <td>申请人身份证正面</td>

                            <td>
                                <span class="m-l-sm"><?=showImage($model['contacts_card_electronic_2'],300,300)?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>申请人身份证反面</td>

                            <td>
                                <span class="m-l-sm"><?=showImage($model['contacts_card_electronic_3'],300,300)?></span>
                            </td>
                        </tr>


                        <tr>
                            <td>银行开户名</td>

                            <td>
                                <span class="m-l-sm"><?=$model['bank_account_name']?></span>
                            </td>
                        </tr>
                                                <tr>
                            <td>公司银行账号</td>

                            <td>
                                <span class="m-l-sm"><?=$model['bank_account_number']?></span>
                            </td>
                        </tr>
                                                <tr>
                            <td>开户银行支行名称</td>

                            <td>
                                <span class="m-l-sm"><?=$model['bank_name']?></span>
                            </td>
                        </tr>
                                                <tr>
                            <td>支行联行号</td>

                            <td>
                                <span class="m-l-sm"><?=$model['bank_code']?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>店铺名称</td>

                            <td>
                                <span class="m-l-sm"><?=$model['shop_name']?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>店铺等级</td>

                            <td>
                                <span class="m-l-sm"><?=$model['shop_type_name']?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>店铺分类</td>

                            <td>
                                <span class="m-l-sm"><?=$model['shop_group_name']?></span>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <?php }else{?>
                    <table id="table-index2" class="table table-hover">
                        <thead>
                            <tr>
                                <th style="width: 20%;">字段名称</th>
                                <th style="width: 20%;">字段数据</th>
                            </tr>

                        </thead>
                        <tbody>


                        <tr>
                            <td>公司名称</td>

                            <td>
                                <span class="m-l-sm"><?=$model['company_name']?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>公司所在地</td>

                            <td>
                                <span class="m-l-sm"><?=getProvinceCityName($model['province_id'])?>-<?=getProvinceCityName($model['city_id'])?>-<?=getProvinceCityName($model['district_id'])?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>公司详细地址</td>

                            <td>
                                <span class="m-l-sm"><?=$model['address_detail']?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>公司电话</td>

                            <td>
                                <span class="m-l-sm"><?=$model['company_phone']?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>公司类型</td>

                            <td>
                                <span class="m-l-sm"><?=$model['company_type']?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>员工总数</td>

                            <td>
                                <span class="m-l-sm"><?=$model['company_employee_count']?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>注册资金</td>

                            <td>
                                <span class="m-l-sm"><?=$model['company_registered_capital']?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>联系人姓名</td>

                            <td>
                                <span class="m-l-sm"><?=$model['contacts_name']?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>联系人电话</td>

                            <td>
                                <span class="m-l-sm"><?=$model['contacts_phone']?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>联系人邮箱</td>

                            <td>
                                <span class="m-l-sm"><?=$model['contacts_email']?></span>
                            </td>
                        </tr>


                        <tr>
                            <td>营业执照号</td>

                            <td>
                                <span class="m-l-sm"><?=$model['business_licence_number']?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>法定经营范围</td>

                            <td>
                                <span class="m-l-sm"><?=$model['business_sphere']?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>营业执照电子版</td>

                            <td>
                                <span class="m-l-sm"><?=showImage($model['business_licence_number_electronic'],300,300)?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>组织机构代码</td>

                            <td>
                                <span class="m-l-sm"><?=$model['organization_code']?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>组织机构代码电子版</td>

                            <td>
                                <span class="m-l-sm"><?=showImage($model['organization_code_electronic'],300,300)?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>一般纳税人证明</td>

                            <td>
                                <span class="m-l-sm"><?=showImage($model['general_taxpayer'],300,300)?></span>
                            </td>
                        </tr>


                        <tr>
                            <td>店铺名称</td>

                            <td>
                                <span class="m-l-sm"><?=$model['shop_name']?></span>
                            </td>
                        </tr>
                        <tr>
                            <td>店铺等级</td>

                            <td>
                                <span class="m-l-sm"><?=$model['shop_type_name']?></span>
                            </td>
                        </tr>

                        <tr>
                            <td>店铺分类</td>

                            <td>
                                <span class="m-l-sm"><?=$model['shop_group_name']?></span>
                            </td>
                        </tr>


                        </tbody>
                    </table>
                    <?php } ?>
                </div>

                <form id="pt_form" method="post">
                    <div class="box-body">

                        <input type="hidden" name="apply_id" value="<?=input('apply_id')?>">
                        <div class="clearfix"></div>

                        <div class="form-group ">
                            <div class="col-sm-2 text-right">
                                <label for="shop_id" class="control-label Validform_label">审核状态</label>
                            </div>
                            <div class="col-sm-10">
                                <select id="shop_id" name="apply_status" class="form-control">
                                    <option value="1">通过</option>
                                    <option value="2">拒绝</option>
                                </select>
                                <div class="help-block"></div>
                            </div>
                        </div>

                        <div class="form-group ">
                            <div class="col-sm-2 text-right">
                                <label for="refuse_reason" class="control-label Validform_label">审核不通过原因</label>
                            </div>
                            <div class="col-sm-10">
                                <input type="text" id="refuse_reason" class="form-control" name="refuse_reason" placeholder="请输入拒绝原因">
                                <div class="help-block"></div>
                            </div>
                        </div>


                    </div>
                    <div class="box-footer text-center">
                        <button class="btn btn-primary" type="button" id="form_button">保存</button>
                        <span class="btn btn-white" onclick="history.go(-1)">返回</span>
                    </div>
                </form>
            </div>
        </div>
</section>
{/block}

{block name="js"}
<script>
    $('#form_button').click(function(){
        if($('select[name="apply_status"]').val() == 2){
            if(!$('#refuse_reason').val()) {
                toastr.error('拒绝原因必须填写');
                return false;
            }
        }
        let apply_id = $('input[name="apply_id"]').val();
        let refuse_reason = $('#refuse_reason').val();
        let apply_status = $('select[name="apply_status"]').val();
        $.ajax({
            url:"<?=url('admin/ShopApply/update')?>",
            type:'post',
            data:{apply_id:apply_id,refuse_reason:refuse_reason,apply_status:apply_status},
            dataType:'json',
            success:function(res){
                if(res.code == 200){
                    window.location.href="<?=url('admin/ShopApply/index')?>";
                }
            },
            error:function(){}
        });
    });
</script>
{/block}


